package com.yhn.bubblevideo.common.utils;

import cn.hutool.core.util.IdUtil;

/**
 * 封装hutool雪花算法
 *
 * @author yhnyhn123
 */
public class SnowUtil {

    private static final long DATA_CENTER_ID = 1;  //数据中心
    private static final long WORKER_ID = 1;     //机器标识

    public static long getSnowflakeNextId() {
        return IdUtil.getSnowflake(WORKER_ID, DATA_CENTER_ID).nextId();
    }

    public static String getSnowflakeNextIdStr() {
        return IdUtil.getSnowflake(WORKER_ID, DATA_CENTER_ID).nextIdStr();
    }
}
